package hvz.app;

//import android.app.Activity;
import java.util.List;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

public class GoogleMapsView extends MapActivity {
	
	private MapView mapView;
	private LocationManager locationManager;
	private Button back;
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.google_maps_view);  
        
        back = (Button)findViewById(R.id.mapCancel);
        
        back.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View v) {
				Intent nextScreen = new Intent(getApplicationContext(), ZombieActivity.class);
				startActivity(nextScreen);
				finish();
				
			}
		});
        
        mapView = (MapView) findViewById(R.id.mapview);
    	mapView.setBuiltInZoomControls(true);
    	
    	List<Overlay> mapOverlays = mapView.getOverlays();
    	Drawable drawable = this.getResources().getDrawable(R.drawable.skullmarker);
    	HvzItemizedOverlay itemizedOverlay = new HvzItemizedOverlay(drawable, this);
    	
    	//Gets current GPS location
    	//System.out.println("got here!");
    	//locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    	//System.out.println("location manager!");
    	//Criteria criteria = new Criteria();
    	//System.out.println("set criteria!");
    	//String bestProvider = locationManager.getBestProvider(criteria, true);
    	//System.out.println("Best provider is " + bestProvider);
    	//Location location = locationManager.getLastKnownLocation(bestProvider);
    	//System.out.println("got location!");
    	//locationManager.requestLocationUpdates(bestProvider, 0, 0, new TestLocationListener());
    	
    	GeoPoint point = new GeoPoint(19240000, -99120000);
    	//GeoPoint point = new GeoPoint((int) (location.getLatitude() * 1e6), (int) (location.getLongitude() * 1e6));
    	OverlayItem overlayItem = new OverlayItem(point, "Death Location", "Dead Person");
    	itemizedOverlay.addOverlay(overlayItem);
    	mapOverlays.add(itemizedOverlay);
	}
	
	  @Override
	    protected boolean isRouteDisplayed() {
	        // TODO Auto-generated method stub
	        return false;
	    }
}
